﻿
using HBase;
using hCommand;
using System;
using System.Collections.Generic;

namespace Persistence {
    public class WMSTransactionFacade {
        static SrcGroupBSCase<CoreStock> continue99999Engine = new SrcGroupBSCase<CoreStock>();
        static LocAreaChangeBSEngine locAreaChangeEngine = new LocAreaChangeBSEngine();
        static WcsFinshParamCase wcsFinshParamEngine = new WcsFinshParamCase();
        static DooCase dooEngine = new DooCase();
        static InLocCase inLocEngine = new InLocCase();
        static CsdOutEngine outDetEngine = new CsdOutEngine();
        static CsdSplitEngine splitDetEngine = new CsdSplitEngine();
        static CsdSaveEngine changeCSDEngine = new CsdSaveEngine();
        static DooDeleteDetailEngine deleteDetailEngine = new DooDeleteDetailEngine();
       
        static DirectOutCase directOutEngine = new DirectOutCase();
        static DetOutCase detOutEngine = new DetOutCase();
       
        static DesMoveBSEngine<CoreStock> craneMoveEngine = new DesMoveBSEngine<CoreStock>();
        static PkCase pkEngine = new PkCase();
        static PkFinshEngine pkFinshEngine = new PkFinshEngine();
        static Csd2CsEngine csd2CsEngine = new Csd2CsEngine();
        public static TransRes doCsd2CsEngine(long id, long pid,bool pk=false) {
            
                csd2CsEngine.id = id;
                csd2CsEngine.pid = pid;
                csd2CsEngine.pingku = pk;
                return csd2CsEngine.doWork();
            
        }

        public static TransRes doContinue99999Engine(long paramId) {
            
                continue99999Engine.paramId = paramId;
                return continue99999Engine.doWork();
             
        }
 


        public static bool doCraneMoveEngine(long stockId, long des) {
             
                craneMoveEngine.stockId = stockId;
                craneMoveEngine.des = (int)des;
                TransRes res = craneMoveEngine.doWork();
                return res.s;
            
        }




      


       
        public static bool syncWcsReult(long paramId, int realStn) {
            
                wcsFinshParamEngine.paramId = paramId;
                wcsFinshParamEngine.realStn = realStn;
                TransRes res = wcsFinshParamEngine.doWork();
                return res.s;
             
        }


        public static TransRes doDooEngine(WhDoo whReceipt) {
            
                dooEngine.doo = whReceipt;
                return dooEngine.doWork();

           
        }
        public static TransRes doDooDeleteDetEngine(WhDooDet wdd) {
            
                deleteDetailEngine.wdd = wdd;
                return deleteDetailEngine.doWork();
 
        }


        public static TransRes doPkFinshEngine(long pkId) {
            
                pkFinshEngine.pkId = pkId;
                return pkFinshEngine.doWork();

             
        }




        public static string doPkEngine(long pkId) {
            
                pkEngine.pkId = pkId;
                TransRes res = pkEngine.doWork();
                return res.msg;
 
        }

        public static string doLocAreaChangeEngine(long locId, long areaId, int activeStatus) {
            
                locAreaChangeEngine.locId = (int)locId;
                locAreaChangeEngine.areaId = areaId;
                locAreaChangeEngine.activeStatus = activeStatus;
                TransRes res = locAreaChangeEngine.doWork();
                return res.msg;
 
        }
       

      

        
        public static TransRes doStockinLocEngine(String boxCode, int stn, int eigen) {
             
                inLocEngine.stn = stn; //固定入库口 测试用
                inLocEngine.boxCode = boxCode;

                inLocEngine.eigen = eigen;
                TransRes res = inLocEngine.doWork();
                return res;
            
        }
        
       
        public static TransRes doSplitDetEngine(CoreStockDet det) {
            
                splitDetEngine.det = det;
                TransRes res = splitDetEngine.doWork();
                return res;
             
        }

        public static TransRes doOutDetEngine(long id) {
            
                outDetEngine.id = id;
                TransRes res = outDetEngine.doWork();
                return res;
            
        }
        public static TransRes doChangeCSDEngine(CoreStockDet csd) {
            
                changeCSDEngine.csd = csd;
                TransRes res = changeCSDEngine.doWork();
                return res;
             
        }
        


      


        public static TransRes doDirectOutEngine(long stockId) {
 
                directOutEngine.stockId = stockId;
                TransRes res = directOutEngine.doWork();
                return res;
            
        }

        public static TransRes doDetOutEngine(long detId) {
             
                detOutEngine.detId = detId;
                TransRes res = detOutEngine.doWork();
                return res;
             
        }


    }
}
